package com.doit.demo01;

public class test_Math {
    public static void main(String[] args) {
        System.out.println(Math.PI);
        //绝对值
        System.out.println(Math.abs(-10));//10
        //四舍五入
        System.out.println(Math.round(3.3));//3
        System.out.println(Math.round(3.5f));//4
        //向上取整
        System.out.println(Math.ceil(10.1));//11.0
        System.out.println(Math.ceil(-10.9));//-10.0
        //向下取整
        System.out.println(Math.floor(10.1));//10.0
        System.out.println(Math.floor(-10.9));//-11.0
        //最大值 最小值
        System.out.println(Math.max(10,30));//30
        System.out.println(Math.min(10,30));//10
        //a的b次幂
        System.out.println(Math.pow(2,3));//8.0
        //生成随机小数
        System.out.println(Math.random());//[0,1)
    }
}
